﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microserve.TeleEye.BusinessServices;

using MenuBar = Microserve.TeleEye.Common.MenuBar;
using System.Text;
using Microserve.TeleEye.Common.Products;

namespace Microserve.TeleEye.Web
{
    public partial class Section : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string sectionname = Page.Request.QueryString["s"];

            if (!Utility.Validators.ValidateSectionName(sectionname))
            {
                sectionname = "wheretobuyhome";
            }
            MenuController controller = new MenuController();
            List<MenuBar.MenuItem> items = controller.GetSectionMenu(HttpContext.Current,
                sectionname);

            this.toolboxlist.Controls.Add(new LiteralControl()
            {
                Text =
                    Utility.MenuFactory.GenerateMenu(items)
            });


            FeaturedProductManager fpManager = new FeaturedProductManager();
            List<Microserve.TeleEye.Common.Products.Product> fProducts = fpManager.GetFeaturedProducts(HttpContext.Current,
                sectionname);

            this.featuredProducts.DataSource = fProducts;
            this.featuredProducts.DataBind();

            SectionManager sManager = new SectionManager();
            this.sectionTitle.InnerHtml = sManager.GetSectionTitle(HttpContext.Current, sectionname);
            this.rightTitle.InnerHtml = sManager.GetSectionSubtitle(HttpContext.Current, sectionname);
            this.sectionAbstract.InnerHtml = sManager.GetSectionAbstract(HttpContext.Current, sectionname);
        }
    }
}
